﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;

namespace DFGK_WMS.Common;

/// <summary>
/// 加载配置文件
/// </summary>
public static class Config
{
    private static IConfiguration GetConfig()
    {
        return new ConfigurationBuilder()
            .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
            .Build();
    }
    private static IConfiguration AppSettings => GetConfig();
    /// <summary>
    /// Wcs
    /// </summary>
    public static string WcsBaseUrl => AppSettings.GetValue<string>("WcsBaseUrl") ?? string.Empty;
    /// <summary>
    /// 是否为测试环境
    /// </summary>
    public static bool IsDev => AppSettings.GetValue<bool>("IsDev");

    /// <summary>
    /// WMS库房编码
    /// </summary>
    public static string WMSWarehouseCode => AppSettings.GetValue<string>("WMSWarehouseCode") ?? string.Empty;
}